home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / ui / att.c next >
Encoding:
C/C++ Source or Header  |  1990-04-20  |  1.4 KB  |  90 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1989, Tera Computer Company
  5.  **/
  6.  
  7. // attribute.c -- routines to manipulate built-in attributes
  8.  
  9. #include "att.h"
  10.  
  11. // The following routines provide a 'successor' and 'predecessor' function
  12. // for shapes, colors, and brushes.  The functions are defined so they
  13. // wraparound, for example, the successor to the last shape is defined
  14. // to be the first shape, and the predecessor of the first shape is the
  15. // last shape.  This makes it convenient to cycle a node/edge through 
  16. // the various values for these attributes, and to cycle the buttons
  17. // for the built-in attributes through their various values
  18.  
  19. NShape NextShape(NShape s)
  20. {
  21.     if (s != numshape - 2)
  22.     {
  23.     return s + 1;
  24.     }
  25.     else
  26.     {
  27.     return rectangle;
  28.     }
  29. }
  30.  
  31. CType NextColor(CType c)
  32. {
  33.     if (c != numcolor - 1)
  34.     {
  35.     return c + 1;
  36.     }
  37.     else
  38.     {
  39.     return blackc;
  40.     }
  41. }
  42.  
  43. BType NextBrush(BType b)
  44. {
  45.     if (b != numbrush - 1)
  46.     {
  47.     return b + 1;
  48.     }
  49.     else
  50.     {
  51.     return solidb;
  52.     }
  53. }
  54.  
  55. NShape PrevShape(NShape s)
  56. {
  57.     if (s != rectangle)
  58.     {
  59.     return s - 1;
  60.     }
  61.     else
  62.     {
  63.     return numshape - 2;
  64.     }
  65. }
  66.  
  67. CType PrevColor(CType c)
  68. {
  69.     if (c != blackc)
  70.     {
  71.     return c - 1;
  72.     }
  73.     else
  74.     {
  75.     return numcolor - 1;
  76.     }
  77. }
  78.  
  79. BType PrevBrush(BType b)
  80. {
  81.     if (b != solidb)
  82.     {
  83.     return b - 1;
  84.     }
  85.     else
  86.     {
  87.     return numbrush - 1;
  88.     }
  89. }
  90.